\hypertarget{class_timer_manager}{
\section{TimerManager Class Reference}
\label{class_timer_manager}\index{TimerManager@{TimerManager}}
}


{\ttfamily \hyperlink{class_timer_manager}{TimerManager}} class instance is used for managing all the game timers for animation, game states, effects etc.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_timer_manager_ae9676f2b9a1ed9b1ffd63f204eeccec6}{$\sim$TimerManager} ()
\begin{DoxyCompactList}\small\item\em Destructor of \hyperlink{class_timer_manager}{TimerManager} class. \item\end{DoxyCompactList}\item 
void \hyperlink{class_timer_manager_ad00c4a27d1303593d1dc63d52ccacea1}{startGameTimer} (\hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType}, int startTime=0)
\begin{DoxyCompactList}\small\item\em Starts a game timer of given type with given start time. \item\end{DoxyCompactList}\item 
void \hyperlink{class_timer_manager_aa074948701192e0c933d38620e9dae4c}{stopGameTimer} (\hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType})
\begin{DoxyCompactList}\small\item\em Stops the game timer of give type. \item\end{DoxyCompactList}\item 
void \hyperlink{class_timer_manager_a623191acd0681cfeeb4dab77124ea14c}{updateTimers} (int timeStep)
\begin{DoxyCompactList}\small\item\em Increments all the running timers with given time step. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_timer_manager_a8d3450f4ad70fccb1141858d6f4f47ad}{isActive} (\hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType})
\begin{DoxyCompactList}\small\item\em Queries if a timer of given type is started but not reached full time. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_timer_manager_a9f10860b8f6e154a8e7063f74a98d460}{isFirstQuarterTime} (\hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType})
\begin{DoxyCompactList}\small\item\em For querying if the first quarter time of a given timer type is reached. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_timer_manager_a6fc66f807a0285c00168d5629ba19852}{isHalfTime} (\hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType})
\begin{DoxyCompactList}\small\item\em For querying if the half time of a given timer type is reached. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_timer_manager_acacad69dbd95f6f30e17e6af8607c3ec}{isLastQuarterTime} (\hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType})
\begin{DoxyCompactList}\small\item\em For querying if the last quarter time of a given timer type is reached. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_timer_manager_a027d3bd1945406327cdb354df41d7d3b}{isFullTime} (\hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType})
\begin{DoxyCompactList}\small\item\em For querying if the full time of a given timer type is reached. \item\end{DoxyCompactList}\item 
int \hyperlink{class_timer_manager_a1e5cd3099c5196e6dd0fae10eea7d3b3}{time} (\hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType})
\begin{DoxyCompactList}\small\item\em The current time of timer of given type. \item\end{DoxyCompactList}\item 
int \hyperlink{class_timer_manager_afa213e5b77b52a69c688a5e6654721ac}{timerLength} (\hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType})
\begin{DoxyCompactList}\small\item\em The timer length -\/-\/-\/ the ending time of timer of given type. \item\end{DoxyCompactList}\item 
GLfloat \hyperlink{class_timer_manager_a2e104c786ebd190de7d8cd5d82bf9d8f}{timeRel} (\hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType})
\begin{DoxyCompactList}\small\item\em Relational value of timer progress. \item\end{DoxyCompactList}\item 
\hypertarget{class_timer_manager_a702d25b88e7df6d71c98a18e8212e2d9}{
void \hyperlink{class_timer_manager_a702d25b88e7df6d71c98a18e8212e2d9}{resetTimers} ()}
\label{class_timer_manager_a702d25b88e7df6d71c98a18e8212e2d9}

\begin{DoxyCompactList}\small\item\em Resets all the timers. \item\end{DoxyCompactList}\item 
\hypertarget{class_timer_manager_a5970cbaf9829b4f62ce6807cce49ec5c}{
void \hyperlink{class_timer_manager_a5970cbaf9829b4f62ce6807cce49ec5c}{cleanData} ()}
\label{class_timer_manager_a5970cbaf9829b4f62ce6807cce49ec5c}

\begin{DoxyCompactList}\small\item\em Cleans all the static effect data. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \hyperlink{class_timer_manager}{TimerManager} $\ast$ \hyperlink{class_timer_manager_a7a1b909d401f71e09692094d16eef6a0}{getInstance} ()
\begin{DoxyCompactList}\small\item\em Provides instance of {\ttfamily \hyperlink{class_timer_manager}{TimerManager}} class, creates a new instance if an existing instance is not available. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_timer_manager_a6d4d20faf533fcf7e42b48996ee61996}{
static \hyperlink{class_hyper_jump_effect_data}{HyperJumpEffectData} $\ast$ \hyperlink{class_timer_manager_a6d4d20faf533fcf7e42b48996ee61996}{hyperJumpOutData} = NULL}
\label{class_timer_manager_a6d4d20faf533fcf7e42b48996ee61996}

\begin{DoxyCompactList}\small\item\em Used to store hyper jump effect data. \item\end{DoxyCompactList}\item 
\hypertarget{class_timer_manager_a3196dd09336613c936f3936d759363f2}{
static \hyperlink{class_hyper_jump_effect_data}{HyperJumpEffectData} $\ast$ \hyperlink{class_timer_manager_a3196dd09336613c936f3936d759363f2}{hyperJumpInData} = NULL}
\label{class_timer_manager_a3196dd09336613c936f3936d759363f2}

\begin{DoxyCompactList}\small\item\em Used to store hyper jump effect data. \item\end{DoxyCompactList}\item 
\hypertarget{class_timer_manager_a6d52e10b41b535e8e394de70efee4580}{
static \hyperlink{class_bomb_effect_data}{BombEffectData} $\ast$ \hyperlink{class_timer_manager_a6d52e10b41b535e8e394de70efee4580}{bombEffectData} = NULL}
\label{class_timer_manager_a6d52e10b41b535e8e394de70efee4580}

\begin{DoxyCompactList}\small\item\em Used to store bomb effect data. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
{\ttfamily \hyperlink{class_timer_manager}{TimerManager}} class instance is used for managing all the game timers for animation, game states, effects etc. Game timers are instances of {\ttfamily \hyperlink{class_game_timer}{GameTimer}} class. When instantiating a {\ttfamily \hyperlink{class_timer_manager}{TimerManager}} it creates instances of all the timers and stores them into a {\ttfamily timers} vector. {\ttfamily \hyperlink{class_timer_manager}{TimerManager}} is used for starting, stopping and reseting timers and for requesting timer states. It also provides methods for requesting timer states (is timer active or is full time, half time or first/last quarter time reached) and for reseting timers and cleaning effect data.

Singleton design pattern is used at \hyperlink{class_timer_manager}{TimerManager} to ensure that only one instance exists.

{\ttfamily \hyperlink{class_timer_manager}{TimerManager}} contains pointer for hyper jump and bomb effect data. The timer lengths are defined as enumeration value.

Instantiating {\ttfamily \hyperlink{class_timer_manager}{TimerManager}:} 
\begin{DoxyCode}
 TimerManager *timerManager = TimerManager::getInstance();
\end{DoxyCode}


Starting a timer: 
\begin{DoxyCode}
 timerManager->startGameTimer(GameTimer::stateGetReadyTimer);
\end{DoxyCode}


Checking if timer is active (running but not yet finished): 
\begin{DoxyCode}
 if (timerManager->isActive(GameTimer::stateGetReadyTimer)) {
      // ...
 }
\end{DoxyCode}


Updating running timers: 
\begin{DoxyCode}
 timerManager->updateTimers(timestep);
\end{DoxyCode}


Checking if full time is reached (this is one-\/shot, true is returned only once when full time has passed): 
\begin{DoxyCode}
 if (timerManager->isFullTime(GameTimer::stateGetReadyTimer)) {
    // ...
 }
\end{DoxyCode}


Stopping a timer: 
\begin{DoxyCode}
 timerManager->stopGameTimer(GameTimer::stateGetReadyTimer);
\end{DoxyCode}


Resetting the timers and cleaning up the effect data. 
\begin{DoxyCode}
 timerManager->resetTimers();
 timerManager->cleanData();
\end{DoxyCode}
 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_timer_manager_ae9676f2b9a1ed9b1ffd63f204eeccec6}{
\index{TimerManager@{TimerManager}!$\sim$TimerManager@{$\sim$TimerManager}}
\index{$\sim$TimerManager@{$\sim$TimerManager}!TimerManager@{TimerManager}}
\subsubsection[{$\sim$TimerManager}]{\setlength{\rightskip}{0pt plus 5cm}TimerManager::$\sim$TimerManager (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_ae9676f2b9a1ed9b1ffd63f204eeccec6}


Destructor of \hyperlink{class_timer_manager}{TimerManager} class. 

Cleans up all the statically stored effect data. 

\subsection{Member Function Documentation}
\hypertarget{class_timer_manager_a7a1b909d401f71e09692094d16eef6a0}{
\index{TimerManager@{TimerManager}!getInstance@{getInstance}}
\index{getInstance@{getInstance}!TimerManager@{TimerManager}}
\subsubsection[{getInstance}]{\setlength{\rightskip}{0pt plus 5cm}{\bf TimerManager} $\ast$ TimerManager::getInstance (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}static\mbox{]}}}}
\label{class_timer_manager_a7a1b909d401f71e09692094d16eef6a0}


Provides instance of {\ttfamily \hyperlink{class_timer_manager}{TimerManager}} class, creates a new instance if an existing instance is not available. 

\begin{DoxyReturn}{Returns}
A {\ttfamily \hyperlink{class_timer_manager}{TimerManager}} instance 
\end{DoxyReturn}
\hypertarget{class_timer_manager_a8d3450f4ad70fccb1141858d6f4f47ad}{
\index{TimerManager@{TimerManager}!isActive@{isActive}}
\index{isActive@{isActive}!TimerManager@{TimerManager}}
\subsubsection[{isActive}]{\setlength{\rightskip}{0pt plus 5cm}bool TimerManager::isActive (
\begin{DoxyParamCaption}
\item[{{\bf GameTimer::TimerType}}]{ type}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_a8d3450f4ad70fccb1141858d6f4f47ad}


Queries if a timer of given type is started but not reached full time. 


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType}} game timer enumeration types \end{DoxyParams}
\hypertarget{class_timer_manager_a9f10860b8f6e154a8e7063f74a98d460}{
\index{TimerManager@{TimerManager}!isFirstQuarterTime@{isFirstQuarterTime}}
\index{isFirstQuarterTime@{isFirstQuarterTime}!TimerManager@{TimerManager}}
\subsubsection[{isFirstQuarterTime}]{\setlength{\rightskip}{0pt plus 5cm}bool TimerManager::isFirstQuarterTime (
\begin{DoxyParamCaption}
\item[{{\bf GameTimer::TimerType}}]{ type}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_a9f10860b8f6e154a8e7063f74a98d460}


For querying if the first quarter time of a given timer type is reached. 

Note: This is works as a ''one-\/shot'' method for each timer run. When the first quarter time has been reached, true will be returned only the first time asked.


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType}} game timer enumeration types \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns true once when the first quarter time of given timer type has passed 
\end{DoxyReturn}
\hypertarget{class_timer_manager_a027d3bd1945406327cdb354df41d7d3b}{
\index{TimerManager@{TimerManager}!isFullTime@{isFullTime}}
\index{isFullTime@{isFullTime}!TimerManager@{TimerManager}}
\subsubsection[{isFullTime}]{\setlength{\rightskip}{0pt plus 5cm}bool TimerManager::isFullTime (
\begin{DoxyParamCaption}
\item[{{\bf GameTimer::TimerType}}]{ type}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_a027d3bd1945406327cdb354df41d7d3b}


For querying if the full time of a given timer type is reached. 

Note: This is works as a ''one-\/shot'' method for each timer run. When the full time has been reached, true will be returned only the first time asked.


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType}} game timer enumeration types \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns true once when the full time of given timer type has passed 
\end{DoxyReturn}
\hypertarget{class_timer_manager_a6fc66f807a0285c00168d5629ba19852}{
\index{TimerManager@{TimerManager}!isHalfTime@{isHalfTime}}
\index{isHalfTime@{isHalfTime}!TimerManager@{TimerManager}}
\subsubsection[{isHalfTime}]{\setlength{\rightskip}{0pt plus 5cm}bool TimerManager::isHalfTime (
\begin{DoxyParamCaption}
\item[{{\bf GameTimer::TimerType}}]{ type}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_a6fc66f807a0285c00168d5629ba19852}


For querying if the half time of a given timer type is reached. 

Note: This is works as a ''one-\/shot'' method for each timer run. When the half time has been reached, true will be returned only the first time asked.


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType}} game timer enumeration types \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns true once when the half time of given timer type has passed 
\end{DoxyReturn}
\hypertarget{class_timer_manager_acacad69dbd95f6f30e17e6af8607c3ec}{
\index{TimerManager@{TimerManager}!isLastQuarterTime@{isLastQuarterTime}}
\index{isLastQuarterTime@{isLastQuarterTime}!TimerManager@{TimerManager}}
\subsubsection[{isLastQuarterTime}]{\setlength{\rightskip}{0pt plus 5cm}bool TimerManager::isLastQuarterTime (
\begin{DoxyParamCaption}
\item[{{\bf GameTimer::TimerType}}]{ type}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_acacad69dbd95f6f30e17e6af8607c3ec}


For querying if the last quarter time of a given timer type is reached. 

Note: This is works as a ''one-\/shot'' method for each timer run. When the last quarter time has been reached, true will be returned only the first time asked.


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType}} game timer enumeration types \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns true once when the last quarter time of given timer type has passed 
\end{DoxyReturn}
\hypertarget{class_timer_manager_ad00c4a27d1303593d1dc63d52ccacea1}{
\index{TimerManager@{TimerManager}!startGameTimer@{startGameTimer}}
\index{startGameTimer@{startGameTimer}!TimerManager@{TimerManager}}
\subsubsection[{startGameTimer}]{\setlength{\rightskip}{0pt plus 5cm}void TimerManager::startGameTimer (
\begin{DoxyParamCaption}
\item[{{\bf GameTimer::TimerType}}]{ type, }
\item[{int}]{ startTime = {\ttfamily 0}}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_ad00c4a27d1303593d1dc63d52ccacea1}


Starts a game timer of given type with given start time. 

If no start time is provided will start the timer from 0.


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType}} game timer enumeration types \item[{\em startTime}]The timer start time in milliseconds \end{DoxyParams}
\hypertarget{class_timer_manager_aa074948701192e0c933d38620e9dae4c}{
\index{TimerManager@{TimerManager}!stopGameTimer@{stopGameTimer}}
\index{stopGameTimer@{stopGameTimer}!TimerManager@{TimerManager}}
\subsubsection[{stopGameTimer}]{\setlength{\rightskip}{0pt plus 5cm}void TimerManager::stopGameTimer (
\begin{DoxyParamCaption}
\item[{{\bf GameTimer::TimerType}}]{ type}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_aa074948701192e0c933d38620e9dae4c}


Stops the game timer of give type. 


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType}} game timer enumeration types \end{DoxyParams}
\hypertarget{class_timer_manager_a1e5cd3099c5196e6dd0fae10eea7d3b3}{
\index{TimerManager@{TimerManager}!time@{time}}
\index{time@{time}!TimerManager@{TimerManager}}
\subsubsection[{time}]{\setlength{\rightskip}{0pt plus 5cm}int TimerManager::time (
\begin{DoxyParamCaption}
\item[{{\bf GameTimer::TimerType}}]{ type}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_a1e5cd3099c5196e6dd0fae10eea7d3b3}


The current time of timer of given type. 


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType}} game timer enumeration types \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Current running time of the timer of given type. 
\end{DoxyReturn}
\hypertarget{class_timer_manager_a2e104c786ebd190de7d8cd5d82bf9d8f}{
\index{TimerManager@{TimerManager}!timeRel@{timeRel}}
\index{timeRel@{timeRel}!TimerManager@{TimerManager}}
\subsubsection[{timeRel}]{\setlength{\rightskip}{0pt plus 5cm}GLfloat TimerManager::timeRel (
\begin{DoxyParamCaption}
\item[{{\bf GameTimer::TimerType}}]{ type}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_a2e104c786ebd190de7d8cd5d82bf9d8f}


Relational value of timer progress. 


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType}} game timer enumeration types \end{DoxyParams}
\begin{DoxyReturn}{Returns}
A relational value of timer progress from 0 to 1 
\end{DoxyReturn}
\hypertarget{class_timer_manager_afa213e5b77b52a69c688a5e6654721ac}{
\index{TimerManager@{TimerManager}!timerLength@{timerLength}}
\index{timerLength@{timerLength}!TimerManager@{TimerManager}}
\subsubsection[{timerLength}]{\setlength{\rightskip}{0pt plus 5cm}int TimerManager::timerLength (
\begin{DoxyParamCaption}
\item[{{\bf GameTimer::TimerType}}]{ type}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_afa213e5b77b52a69c688a5e6654721ac}


The timer length -\/-\/-\/ the ending time of timer of given type. 


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548}{GameTimer::TimerType}} game timer enumeration types \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Length of the timer of given type 
\end{DoxyReturn}
\hypertarget{class_timer_manager_a623191acd0681cfeeb4dab77124ea14c}{
\index{TimerManager@{TimerManager}!updateTimers@{updateTimers}}
\index{updateTimers@{updateTimers}!TimerManager@{TimerManager}}
\subsubsection[{updateTimers}]{\setlength{\rightskip}{0pt plus 5cm}void TimerManager::updateTimers (
\begin{DoxyParamCaption}
\item[{int}]{ timestep}
\end{DoxyParamCaption}
)}}
\label{class_timer_manager_a623191acd0681cfeeb4dab77124ea14c}


Increments all the running timers with given time step. 


\begin{DoxyParams}{Parameters}
\item[{\em timestep}]An increment to timers in milliseconds. \end{DoxyParams}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
timermanager.h\item 
timermanager.cpp\end{DoxyCompactItemize}
